/**
 * 函数组合的调试和跟踪(调试)
 * 要求： 把NEVER SAY DIE 变成 nerver-say-die
 */
const _ = require("lodash");
//追踪函数
const trace = _.curry((tag, value) => {
  console.log(tag, value);
  return value;
});
//为了能满足使用函数组合做二次封装
const split = _.curry((seq, taget) => _.split(taget, seq));
const map = _.curry((fn, array) => _.map(array, fn));
const join = _.curry((seq, target) => _.join(target, seq));

const f = _.flowRight(
  join("-"),
  trace("toLower之后的"),
  map(_.toLower),
  trace("split之后的"),
  split(" ")
);
console.log(f("NEVER SAY DIE"));
